import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// import cesium from "vite-plugin-cesium";
export default defineConfig({
    server: {
        host: "localhost", // 服务器主机名，如果允许外部访问，可设置为"0.0.0.0"
        port: 8090,
        open: true,
        cors: true,
        // https: false,
        // 代理跨域（mock 不需要配置，这里只是个事列）
        proxy: {
            "/localhost": {
                target: "http://127.0.0.1:8080", // easymock
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/localhost/, ""),
            },
        },
    },
    build: {
        emptyOutDir: true,
        rollupOptions: {
            output: {
                chunkFileNames: "static/js/[name]-[hash].js",
                entryFileNames: "static/js/[name]-[hash].js",
                assetFileNames: "static/[ext]/[name]-[hash].[ext]",
                manualChunks(id) {
                    if (id.includes("node_modules")) {
                        return id
                            .toString()
                            .split("node_modules/")[1]
                            .split("/")[0]
                            .toString();
                    }
                },
            },
        },
    },
    plugins: [
        react(),
    // cesium()
    ],
});
